<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/taglibs.jsp"%>
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link href="${ctx}/resources/semanticui/semantic.min.css" rel="stylesheet" type="text/css" />
<link href="${ctx}/resources/apps.css" rel="stylesheet" type="text/css" />
<title>订单详情</title>
</head>
<body>
	<div class="ui segment" id="n-page">
		<h4 class="ui horizontal divider header">
		  <i class="tag icon"></i>
			 订单信息
		</h4>
		<table class="ui definition table">
		  <tbody>
		    <tr>
		      <td class="two wide column">订单编号</td>
		      <td><a href="${ctx}/wechat/hunter/toOrderDetail.do?orderId=${order.id}">YQS${order.ordercode}</a></td>
		    </tr>
		    <tr>
		      <td class="two wide column">订单状态</td>
		      <td><span style="color:#F47e2d;font-weight:bold;">${order.statusName}</span>
		      	<c:if test="${order.status==0}">
		      		<button class="ui button active" id="accept" data-position-id="${order.id}" style="float:right;background-color:#1fbad6!important;padding-top:0.7rem;padding-bottom:0.5rem;color:#fff">接单</button>
		      		<button class="ui button active" id="refuse" data-position-id="${order.id}" style="float:right;background-color:#1fbad6!important;padding-top:0.7rem;padding-bottom:0.5rem;color:#fff">拒单</button>
		      	</c:if>
		      </td>
		    </tr>		    
		    <tr>
		      <td>预约时间</td>
		      <td>${order.orderTime}</td>
		    </tr>
		    <tr>
		      <td>预约服务</td>
		      <td>￥${desc.spec}/${desc.name}</td>
		    </tr>
		    <tr>
		      <td>联系人</td>
				<c:choose>
					<c:when test="${order.status == 0 || order.status == 4 || order.status == 5}">
						<td>接单之后可查看用户信息</td>
					</c:when>
					<c:otherwise><td>${(emp.phone).substring(0,7)}****<a href="${ctx}/wechat/hunter/toViewCandidate.do?mobile=${emp.phone}">点击查看基础信息</a></td></c:otherwise>
				</c:choose>
		    </tr>
		  </tbody>
		</table>
		<div class="ui divider"></div>
		<h4 class="ui horizontal divider header">
		  <i class="user circle outline icon"></i>
			<span style="text-align: center">用户完善的信息</span>
		</h4>
		<c:choose>
			<c:when test="${order.status == 0 || order.status == 4 || order.status == 5}">
				<span style="text-align: center">以下是用户的基本信息，接单之后即可查看</span>
			</c:when>
			<c:otherwise>
				<div class="ui raised segment">
					<p>用户已将简历上传，您可以直接查看</p>
					<input type="hidden" name="employeeId" id="employeeId" value="${resume.employeeId}" />
					<input type="hidden" name="hunterId" id="hunterId" value="${resume.hunterId}" />
					<input type="hidden" name="ordescId" id="ordescId" value="${resume.ordescId}" />
					<input type="hidden" name="orderId" id="orderId" value="${resume.orderId}" />
					<input type="hidden" name="id" id="id" value="${resume.id}" />
					<div class="ui placeholder segment">
						<div class="ui icon header">
							<i class="pdf file outline icon"></i>
								${resume.file}
						</div>
						<c:choose>
							<c:when test="${fn:contains(resume.file,'pdf')==true}">
								<input type="hidden" value="${resume.file}" id="filepdf" >
								<a target="_blank" href="${ctx}/views/wechat/candidate/order/report.jsp?url=${resume.file}"><div class="ui primary button" >预览简历</div></a>
							</c:when>
							<c:when test="${fn:contains(resume.file,'docx')==true}">
								<a target="_blank" href="https://tiaonali.com/${(resume.file).substring(0,(resume.file).lastIndexOf('.'))}.html"><div class="ui primary button">预览简历</div></a>
							</c:when>
							<c:otherwise>
								<a target="_blank" href="https://tiaonali.com/${resume.file}"><div class="ui primary button">预览简历</div></a>
							</c:otherwise>
						</c:choose>
					</div>
					<br/>
					<lable>请在您特别感兴趣的主题前的方框内打勾，以确定对谈的关注重点：(${resume.remarkImp})</lable><br/>
					<p>
						a.澄清对职业生涯发展的理解<br/>
						b.探索自身内在的职业驱动力因素<br/>
						c.明确职业生涯发展中个人和组织间的关系<br/>
						d.运用当前组织中的职业发展体系、机会和资源<br/>
						e.思考个人的职业发展计划<br/>
						f.确立下一步的行动，为实现职业发展目标做好准备<br/>
					</p>
					<label>请简述您的职场经历</label>
					<p>${resume.remarkOnce}</p>
					<label>请简述您目前在职业生涯规划和发展方面的挑战有哪些？</label>
					<p>${resume.remarkDev}</p>
					<label>请简述您希望通过职业生涯规划辅导达成哪些目标？</label>
					<p>${resume.remarkGoal}</p>
				</div>
			</c:otherwise>
		</c:choose>

	</div>
	
    
	<script src="${ctx}/resources/jweixin-1.0.0.js"></script>
	<script src="${ctx}/resources/semanticui/jquery-2.1.4.min.js"></script>
	<script src="${ctx}/resources/semanticui/semantic.js"
		type="text/javascript"></script>
	<script type="text/javascript">
/* 
wx.config({
    debug: false, 
    appId: "${config.appid}",  
    timestamp: ${config.currenttimestamp},  
    nonceStr: "${config.nonceStr}", 
    signature: "${config.signatureStr}", 
    jsApiList: ['checkJsApi',
        'onMenuShareTimeline',
        'onMenuShareAppMessage',
        'onMenuShareQQ',
        'onMenuShareWeibo',
        'showOptionMenu',
        'closeWindow']  
}); */

        var handler = {
            activate : function() {
                $(this).addClass('active').siblings().removeClass('active');

                if($(this).attr('id') == 'closeit') {
                    wx.closeWindow();
                }

                if($(this).attr('id') == 'accept') {
                    var orderId  = $(this).attr('data-position-id');
                    console.log(orderId);
                    var postUrl = '${ctx}/wechat/hunter/updOrder.do';
                    $.ajax({ 
                        url: postUrl, 
                        type: "POST", 
                        data: {orderId:orderId,status:1},
                        success: function(data, status){
                            if (data.errorcode == 0){
                          	  alert(data.msg);
								location.reload()
                            }else{
                                alert(data.msg);
                                $(this).removeClass('disabled');
                            }
                        }, 
                        error: function(){ 
                            alert("服务出错，请稍后尝试"); 
                            $(this).removeClass('disabled');
                        } 
                    });
                  }
                  if($(this).attr('id') == 'refuse') {
                      var orderId  =$(this).attr('data-position-id');
                      console.log(orderId);
                      var postUrl = '${ctx}/wechat/hunter/updOrder.do';
                      $.ajax({ 
                          url: postUrl, 
                          type: "POST", 
                          data: {orderId:orderId,status:5},
                          success: function(data, status){
                              if (data.errorcode == 0){
                            	  	alert(data.msg);
                                  var forwardUrl = '${ctx}/wechat/hunter/toOrderDetail.do?orderId='+ orderId;
                                  window.location.href = forwardUrl;
                              }else{
                                  alert(data.msg);
                                  $(this).removeClass('disabled');
                              }
                          }, 
                          error: function(){ 
                              alert("服务出错，请稍后尝试"); 
                              $(this).removeClass('disabled');
                          } 
                      });
               	 }
            }
        };

        $(document).ready(function() {
          
                $('.button').on('click', handler.activate);
                wx.ready(function() {   
                wx.onMenuShareAppMessage({
                    title: 'Headoffer--专业招聘平台----推荐有奖！',  
                    desc: '搭起企业和专业猎头的桥梁，为企业招募英才。',  
                    link: 'http://www.tiaonali.com${ctx}/wechat/hunter/shareservice.page',  
                    imgUrl: 'http://www.tiaonali.com${ctx}/resources/images/sharelogo.jpg',  
                    type: 'link'
                });

                wx.onMenuShareTimeline({
                    title: 'Headoffer--专业招聘平台----推荐有奖！',  
                    desc: '搭起企业和专业猎头的桥梁，为企业招募英才。',  
                    link: 'http://www.tiaonali.com${ctx}/wechat/hunter/shareservice.page',  
                    imgUrl: 'http://www.tiaonali.com${ctx}/resources/images/sharelogo.jpg'
                });

                wx.showOptionMenu();
            });
        });
    </script>
</body>
</html>